<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta content="text/html;charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
	<meta http-equiv ="Pragma" content = "no-cache"/>
	<meta http-equiv="Cache-Control" content="no cache" />
	<meta http-equiv="Expires" content="0" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
	<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<meta name="format-detection" content="telephone=no"/>
	<script src="https://cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
	<link href="https://cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="../../plugins/layui/css/layui.css" media="all"/>
	<link rel="stylesheet" type="text/css" href="../../css/fs.css" media="all"/>
	<script type="text/javascript" src="../../plugins/jquery/jquery.min.js"></script>
	<script type="text/javascript" src="../../plugins/layui/layui.js"></script>
	<script type="text/javascript" src="../../plugins/frame/js/fsDict.js"></script>
	<script type="text/javascript" src="../../plugins/frame/js/fs.js"></script>
	<script type="text/javascript" src="../../plugins/frame/js/frame.js"></script>
	<script type="text/javascript" src="../../scripts/home/yunhetong.js"></script>
</head>
<body>
<div >
	<div class="layui-fluid">
		<div class="layui-row layui-col-space1">
			<div class="layui-col-md12">
				<div class="layui-form-query">
					<form class="layui-form" id="query_form">
						<div class="layui-form-item">
							<div class="layui-inline">
								<label class="layui-form-mid">管理人名称：</label>
								<div class="layui-input-inline" style="width: 200px;">
									<input type="text" name="custNm" autocomplete="off" class="layui-input" />
								</div>
							</div>
							<div class="layui-inline">
								<div class="layui-input-inline">
									<button class="layui-btn" type="button" function="query" onclick="uploadFile('1','2')"><i class="layui-icon">&#xe615;</i>查询</button>
								</div>
							</div>
						</div>
					</form>
				</div>
			</div>
			<div class="layui-col-md12">
				<div class="layui-row grid-demo">
					<div class="layui-col-md12">
						<button class="layui-btn" function="top" topUrl="add.html" topWidth="600px" isMaximize="1" topHeight="400px" topTitle="管理人认证">
							<i class="layui-icon">&#xe654;</i>管理人认证
						</button>
						<button class="layui-btn" function="top" topUrl="add.html" topWidth="600px" isMaximize="0" topHeight="400px" topTitle="新增">
							<i class="layui-icon">&#xe654;</i>管理人信息变更
						</button>

					<!--	<button class="layui-btn layui-btn-danger" function="submit" url="/magerIndeInfo/delete.shtml" isMutiDml="1" isConfirm="1" confirmMsg="是否确定删除选中的数据？" inputs="custNm:">
							<i class="layui-icon">&#xe640;</i>批量删除
						</button>
						<button class="layui-btn" function="refresh">
							<i class="layui-icon">&#x1002;</i>刷新
						</button>-->
						<!--<button class="layui-btn" function="kfapp">
							<i class="layui-icon">&#xe756;</i>测试
						</button>-->
					</div>
					<div class="layui-col-md12">
						<table id="fsDatagrid" lay-filter="fsDatagrid" class="fsDatagrid" isLoad="1" url="/app-yunhetong-center/magerIndeInfo/findAllListPage.shtml" isPage="1" sortType="1" defaultForm="query_form" height="full-135"></table>

						<div class="fsDatagridCols">
							<p type="numbers" title="序号"/>
							<p checkbox="true"/>
							<p field="custNm" title="管理人名称" width="260" sort="true"/>
							<p field="certTyp" title="证件类型" width="160" sort="true" templet="#column2Tpl"/>
							<p field="certNo" title="认证号码" width="160" sort="true"/>
							<p field="caCustId" title="caCustId" width="160" sort="true"/>
						<!--	<p field="idenDate" title="认证时间" width="160" sort="true"/>
							<p field="modiDate" title="最近修改时间" width="160" sort="true"/>-->
							<p field="contractNm" title="合同模板管理" width="160" templet="#contractNmTpl"/>
							<p field="magerNm" title="管理人公章" width="160" templet="#magerNmTpl"/>
							<p field="agentNm" title="法定代表人/授权代表章" width="160" templet="#agentNmTpl"/>
							<p field="cancelContractNm" title="作废协议管理" width="160" templet="#cancelContractNmTpl"/>
							<!--<p fixed="right" align="center" width="160" toolbar="#barDemo" title="操作"/>-->
						</div>
						<script type="text/html" id="barDemo">
							<a id="edit" class="layui-btn layui-btn-xs" lay-event="top" topUrl="edit.html" topMode="edit" topWidth="600px" topHeight="400px" isSelect="1" topTitle="编辑信息" inputs="custNm:">编辑</a>
							<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="top" topUrl="edit.html" topMode="readonly" topWidth="600px" topHeight="400px" topTitle="查看" inputs="custNm:">查看</a>
							<a id="del" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="submit" isConfirm="1" url="/app-yunhetong-center/magerIndeInfo/delete.shtml" inputs="custNm:">删除</a>
						</script>
						<script type="text/html" id="column2Tpl">
							{{# if(d.certTyp=='1'){}}
							<span style="color: #5FB878">社会信用代码</span>
							{{#} else if(d.certTyp=='2'){}}
							<span style="color: #5FB878"> 营业执照注册号</span>
							{{#} else if(d.certTyp=='3'){}}
							<span style="color: #5FB878"> 组织机构代码</span>
							{{#} else {}}
							<span style="color: #5FB878"> </span>
							{{#}}}
						</script>
						<script type="text/html" id="contractNmTpl">
							{{# if(d.contractNm==''){}}
								<a class="layui-btn demoMore"  onclick="uploadFile('E1','{{d.caCustId}}')">添加</a>
							{{#} else {}}
								<a href="javascript:void(0)">{{d.contractNm}}</a>
							   <button type="button" class="layui-btn layui-btn-sm"><i class="layui-icon"></i></button>
							   <button type="button" class="layui-btn layui-btn-sm layui-btn-normal"><i class="layui-icon"></i> 删除</button>
							{{#}}}
						</script>
					</div>
				</div>
			</div>
		</div>


	</div>
</div>
<button class="layui-btn demoMore"  id="uploadBtn" style="display: none">添加A</button>
<script>
	var uploadType='';//上传类型
	var caCustId='';//上传行的管理员认证id
    var myDomain=getRootPath("1");
    var yunHeTongUploadUrl=Api+"/template/upload";
    var uploadUrl=myDomain+'/api/upload/one';
    var token=getLongToken();

    layui.use('upload', function(){

        var $ = layui.jquery
            ,upload = layui.upload;
        //同时绑定多个元素，并将属性设定在元素上
        upload.render({
            elem: '.demoMore'
			,url:yunHeTongUploadUrl
            ,headers:{'token':token}
            ,data:{'templateName':'aa'}
            ,accept: 'file' //普通文件
            ,auto: true
           // ,exts: 'zip|rar|7z' //只允许上传压缩文件
            ,exts: 'docx' //只允许上传压缩文件
            ,multiple: false
            ,size: 10*1024 //限制文件大小，单位 KB
            ,before: function(request){
                //layer.tips('接口地址：'+ this.url, this.item, {tips: 1});
            }
            ,done: function(res, index, upload){
                var item = this.item;
                if(res.code==0){
                    //获取上传成功后返回的结果
					var templateName=res.data.fileName;//模板名称
				}
                console.log(JSON.stringify(res)); //获取当前触发上传的元素，layui 2.1.0 新增
                console.log(JSON.stringify(index)); //获取当前触发上传的元素，layui 2.1.0 新增
                console.log(JSON.stringify(upload)); //获取当前触发上传的元素，layui 2.1.0 新增
            }
        })

    });
    function uploadFile(type,id){
        uploadType=type;
        caCustId=id;
        $("#uploadBtn").click();
	}
</script>
    </body>
</html>

